import {defineStore} from 'pinia'
import {ref,computed} from 'vue'

function initState(){
    return {
        isCollapse:true,
    };
}

export const useAllDataStore = defineStore('allData', () => {
    //ref state属性
    //computed get
    //function
    function selectMenu(val) {
        if (val.name === 'home') {
            state.value.currentMenu = null;
        } else {
            state.value.currentMenu = val;
            let index = state.value.tags.findIndex(item => item.name === val.name);
            index === -1 ? state.value.tags.push(val) : "";
        }
    }
    const state = ref(initState());

    return { 
        state,
        // selectMenu
    
    }
})